<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>01-toDOList.html</title>
    <style>
        * {
            margin: 0px;
            padding: 0px;
        }

        #app {
            margin: 0 auto;
            width: 90%;
        }

        #app .taskInput {
            width: 100%;
            margin-top: 5px;
            display: flex;

        }
        .taskInput input {
            height: 40px;
            border: none;
            outline: none;
            background-color: #f5f5f5;
            flex: 1;

        }
        .taskInput span {
            display: inline-block;
            width: 50px;
            text-align: center;
            line-height: 40px;
            color: lightseagreen;
            font-weight: bolder;
        }

        #app .taskStatus {
            width: 100%;
            margin: 20px auto;
            display: flex;
            justify-content: space-between;
        }
        .taskStatus span {
            background-color: lightskyblue;
            color: white;
            text-align: center;
            line-height: 40px;
            border-radius: 10px;
            flex: 1;
        }
        .taskStatus span:nth-child(2) {
            margin-left: 8px;
            margin-right: 8px;
        }

        #app .taskListBox {
            width: 100%;
            margin-bottom: 20px;
        }
        .taskListBox .taskTitle {
            font-size: 20px;
            font-weight: bolder;
            margin-bottom: 20px;
        }
         .taskListBox .taskList {
            height: 40px;
            line-height: 40px;
            background-color: lightblue;
            margin-bottom: 5px;
            display: flex;  
            justify-content: space-between;

         }
         .taskList .task {
            flex: 1;
         }
         .task span:nth-child(1){ 
            margin-left: 5px;
         }
         .task span:nth-child(2){ 
            margin: 0px 5px;
         }
         .taskList .del {
            width: 50px;
            text-align: center;
         }

    </style>
</head>
<body>
    <div id="app">
        <div class="taskInput">
            <input type="text" placeholder="请输入任务名称" v-model="taskName">
            <span @click="addTask">新增</span>
        </div>
        <div class="taskStatus">
            <span>全部任务( {{taskList.length}} )</span>
            <span>已完成( {{taskList.length - unFinishedTask}} )</span>
            <span>未完成( {{unFinishedTask}} )</span>
        </div>
        <div class="taskListBox">
            <div class="taskTitle">任务列表</div>
            <div class="taskList" v-for="(item, index) in taskList" :key="index">
                <div class="task">
                    <span><input type="checkbox" @click="changeStatus(item)" :checked="item.status"></span>
                    <span> {{item.id}} </span>
                    <span> {{item.name}} </span>
                </div>
                <div class="del" @click="delTask(item, index)">删除</div>
            </div>
        </div>
    </div>

    <script src="./vue-2.5.21.js"></script>
    <script src="./01-toDOList.js"></script>
    
</body>
</html>